//
// Created by 86188 on 2022/9/15.
//

#ifndef TREEPROJECT_HASHTABLE_H
#define TREEPROJECT_HASHTABLE_H
#define p 7
/**
 * 哈希表相关代码
 */
struct record{
    int key;
    int flag;
};

/**
 * 查找hash表
 * @param hashtable
 * @param k
 * @return
 */
int hashsqsearch(struct record hashtable[],int k)
{
    int i,j;
    j = i = k%p;
    while (hashtable[j].key!=k && hashtable[j].flag!=0){
        j = (j+1)%p;
        if(i==j)
            return -1;
    }
    if(hashtable[j].key==k)
        return j;
    else
        return -1;
}
#endif //TREEPROJECT_HASHTABLE_H
